<!DOCTYPE html>

<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <title>Creating a Full Plugin / Learn Vimscript the Hard Way</title>
        <meta name="description" content="">
        <meta name="author" content="Steve Losh">
        <!--[if lt IE 9]>
            <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->

        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

        <link href="/static/styles/skeleton/base.css" rel="stylesheet" type="text/css" />
        <link href="/static/styles/skeleton/skeleton.css" rel="stylesheet" type="text/css" />
        <link href="/static/styles/skeleton/layout.css" rel="stylesheet" type="text/css" />

        <link href="/static/styles/tango.css" rel="stylesheet" type="text/css" />
        <link href="/static/styles/style.less" rel="stylesheet/less" type="text/css" />

        <script type="text/javascript" src="/static/scripts/less.js"></script>
    </head>

    <body class="">
        <div class="container">
            <header class="sixteen columns">
                <h1><a href="/">Learn Vimscript the Hard Way</a></h1>
            </header>

            
    <section class="nav three columns">
        
<ul>
<li><a href="#creating-a-full-plugin">Creating a Full Plugin</a><ul>
<li><a href="#potion">Potion</a></li>
<li><a href="#exercises">Exercises</a></li>
</ul>
</li>
</ul>


        <div class="prevnext">
            
                <a class="prev" href="40.html">&laquo; Prev</a>
            
            
                <a class="next" href="42.html">Next &raquo;</a>
            
        </div>
    </section>

    <section class="content twelve columns offset-by-one">
        <div> 
<h1 id="creating-a-full-plugin">Creating a Full Plugin</h1>
<p>We've covered a lot of ground in the last forty or so chapters.  In the final
part of the book we're going to walk through creating a Vim plugin for
a programming language from scratch.</p>
<p>This is not for the faint of heart.  It's going to take a lot of effort.</p>
<p>If you want to stop now, that's completely fine!  You've already learned enough
to make serious enhancements to your own <code>~/.vimrc</code> file and to fix bugs you
find in other people's plugins.</p>
<p>There's no shame in saying "that's enough for me, I don't want to spend hours
of my life creating plugins I won't use very often".  Be practical.  If you
can't think of a full plugin you want to make, stop now and come back when you
do.</p>
<p>If you <em>do</em> want to continue make sure you're ready to devote some time.  The
rest of the book is going to be intense, and I'm going to assume you actually
want to <em>learn</em>, not just coast through the chapters reading them on your couch.</p>
<h2 id="potion">Potion</h2>
<p>The plugin we're going to make is going to add support for the <a href="http://perl11.github.com/potion/index.html">Potion</a>
programming language.</p>
<p>Potion is a toy language created by _why the lucky stiff before his
disappearance.  It's an extremely small language which makes it ideal for our
purposes.</p>
<p>Potion feels a lot like <a href="http://iolanguage.com/">Io</a>, with some ideas from Ruby, Lua, and other
languages mixed in.  If you've never tried Io it may seem weird.  I strongly
recommend playing with Potion for at least an hour or two.  You won't use it in
real life, but it might change the way you think and expose you to new ideas.</p>
<p>The current implementation of Potion has a lot of rough edges.  For example: if
you mess up the syntax it usually segfaults.  Try not to get too hung up on
this.  I'll provide you with lots of sample code that works so you can focus
mostly on the Vimscript and not Potion.</p>
<p>The goal is not to learn Potion (though that can be fun too).  The goal is to
use Potion as a small example so we can touch on a lot of different aspects of
writing full Vim plugins.</p>
<h2 id="exercises">Exercises</h2>
<p>Download and install <a href="http://perl11.github.com/potion/index.html">Potion</a>.  You're on your own for this one.  It should be
fairly simple.</p>
<p>Make sure you can get the first couple examples in the pamphlet working in the
Potion interpreter and by putting them in a <code>.pn</code> file.  If it seems like the
interpreter isn't working check out <a href="https://github.com/perl11/potion/issues/12">this
issue</a> for a possible cause.</p></div>

        <div class="prevnext">
            
                <a class="prev" href="40.html">&laquo; Previous</a>
            
            
                <a class="next" href="42.html">Next &raquo;</a>
            
        </div>
    </section>


            <footer class="sixteen columns">
                Made by <a href="http://stevelosh.com">Steve Losh</a>.

                <a href="/license.html">License</a>.

                Built with
                <a href="http://bitbucket.org/sjl/bookmarkdown/">Bookmarkdown</a>.
            </footer>
        </div>

        
            <script type="text/javascript">
                var _gaq = _gaq || [];
                _gaq.push(['_setAccount', 'UA-15328874-8']);
                _gaq.push(['_trackPageview']);

                (function() {
                 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
                 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
                 })();
            </script>
        

        
            <script type="text/javascript">
                var _gauges = _gauges || [];
                (function() {
                 var t   = document.createElement('script');
                 t.type  = 'text/javascript';
                 t.async = true;
                 t.id    = 'gauges-tracker';
                 t.setAttribute('data-site-id', '4e8f83b7f5a1f546e200000d');
                 t.src = '//secure.gaug.es/track.js';
                 var s = document.getElementsByTagName('script')[0];
                 s.parentNode.insertBefore(t, s);
                 })();
             </script>
        
    </body>
</html>
